<!DOCTYPE html>
<html>

<head>
    <title>WebSocket Test</title>
</head>

<body>
    <input type="text" name="content" id="txt_msg">
    <button onclick="send()">Send</button>

    <script>
        let ws = new WebSocket("ws://localhost:8080");
        ws.onmessage = function (evt) {
            alert("Recv: " + evt.data);
        }
        function send() {
            let msg = document.getElementById("txt_msg").value;
            ws.send(msg);
        }
    </script>
</body>

</html>